/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sim_test;

import javax.swing.*;
import java.awt.Graphics;
import javax.swing.JPanel;
import java.awt.Image;
import java.awt.Dimension;

/**
 *
 * @author Administrator
 */
public class Sim_JPanelBackground extends JPanel{
    
    private Image backgroundImage;
    private int currentX;
    private int currentY;
    
    public Sim_JPanelBackground(Image img, Dimension size)
    {
        backgroundImage = img;
        currentX = backgroundImage.getWidth(null);
        currentY = backgroundImage.getHeight(null);
        
        setPreferredSize(size);
    }
    
    
    @Override
    public void paintComponent(Graphics g)
    {
        g.drawImage(backgroundImage, 0,0, currentX, currentY, null); 
    }
    
    public Image getImage()
    {
        return backgroundImage;
    }

}
